#!/bin/bash

rootfs_dir=/home/pbb3/qemu-busybox-test/rootfs-xfce
cross_tool_path=/usr/arm-linux-gnueabihf

Iinclude_dir=" -I$cross_tool_path/include -I$rootfs_dir/include/glib-2.0 -I$rootfs_dir/lib/glib-2.0/include"
Llibs_dir=" -L$cross_tool_path/lib -L$rootfs_dir/lib/glib-2.0 -L$rootfs_dir/lib -lglib-2.0"


export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export CC=${CROSS_COMPILE}gcc

export CFLAGS=${Iinclude_dir}
export LDFLAGS=${Llibs_dir}
# LIBS        libraries to pass to the linker, e.g. -l<library>
CPPFLAGS=${Iinclude_dir}
# export CPP=
export CXX=${CROSS_COMPILE}g++
# PKG_CONFIG    path to pkg-config utility
export PKG_CONFIG_PATH=${rootfs_dir}/lib/pkgconfig/glib-2.0.pc:${PKG_CONFIG_PATH}
# PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path
export GLIB_CFLAGS=${Iinclude_dir}
export GLIB_LIBS=${Llibs_dir}

export PREFIX=${rootfs_dir}
export EPREFIX=${rootfs_dir}


./configure --host=arm-linux-gnueabihf --prefix=$rootfs_dir
make
make install

unset CC
unset CFLAGS
unset LDFLAGS
unset LIBS
unset CPPFLAGS
unset CPP
unset PKG_CONFIG
unset PKG_CONFIG_PATH
unset PKG_CONFIG_LIBDIR
unset GLIB_CFLAGS
unset GLIB_LIBS

